package han.cirno.corrupt.throwables

import han.cirno.corrupt.util.ViewUtil.getString

open class WithResIDException(
    private val mainCauseId:Int,
    private val subCauseId:Int?,
    private vararg val arg: String):Exception() {
    override fun getLocalizedMessage(): String {
        return getMessage(mainCauseId, subCauseId, *arg)
    }

    companion object{
        fun getMessage(mainCauseId:Int,subCauseId:Int?,vararg arg: String):String{
            return "${getString(mainCauseId,*arg)} ${if(subCauseId==null) "" else getString(subCauseId)}"
        }
    }
}